import { ItemData } from "../../../resource/info/ItemData";
import { Language } from "../../../../../extend/language/Language";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Cache } from "../../../cache/Cache";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { ParamsConst } from "../../../../common/global/ParamsConst";
import { ProxyType } from "../../../../common/global/ProxyType";
import { MountConfig } from "../../../resource/MountConfig";
import { ItemConfig } from "../../../resource/ItemConfig";
import { ESex } from "../../../../../Message/Public/ESex";
import { MountAddValue } from "../../../rules/MountAddValue";
import { MountUtil } from "../../../scene/mount/MountUtil";
import { EJewel } from "../../../../../Message/Public/EJewel";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { EffectManager } from "../../../manager/EffectManager";
import { MountModelPanel } from "../../mounts/MountModelPanel";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ColorConfig } from "../../../resource/ColorConfig";
import { MountsToolTipPropSp } from "../../mounts/MountsToolTipPropSp";
import { GLabel } from "../../../../../com/mui/controls/GLabel";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { BaseItem } from "../BaseItem";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { TItem } from "../../../../../Message/Db/Tables/TItem";
import { ItemExInfo } from "../../../resource/info/ItemExInfo";
type int = number;
//class MountsToolTip
    
    export  class MountsToolTip /* flash.display.Sprite */
    {
        constructor(arg1: ItemData=null)
        {
            
            this.initUI();
            if (arg1 != null) 
            {
                this.data = arg1;
                this.updateUI();
            }
            return;
        }

        public getNeedLevelText(): string
        {
            var loc1=Language.getString(90211);
            var loc2=GlobalStyle.color6;
            if (this._tItem) 
            {
                loc1 = loc1 + this._tItem.level.toString();
                if (Cache.instance.role.entityInfo.level < this._tItem.level) 
                {
                    loc2 = "#ff0000";
                }
            }
            return "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, loc2) + "</textFormat>";
        }

        public getMountLevelText(): string
        {
            var loc3=null;
            var loc1=Language.getString(70039);
            var loc2=GlobalStyle.color6;
            if (this._itemExInfo) 
            {
                loc1 = loc1 + this._itemExInfo.mount_level.toString();
            }
            else 
            {
                loc1 = loc1 + 1;
            }
            var loc4;
            loc3 = loc4 = "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, loc2) + "</textFormat>";
            return loc4;
        }

        public getItemTypeBindText(): string
        {
            var loc4=0;
            var loc5=null;
            var loc6=null;
            var loc1="#ff87dc";
            var loc2="";
            var loc3="";
            if (this._tItem) 
            {
                loc4 = this._tItem.bind;
                if (!(this._tItem.category == 0) && !(this._tItem.category == 8)) 
                {
                    if (loc5 = GameDefConfig.instance.getECategory(this._tItem.category)) 
                    {
                        loc2 = loc5.name;
                    }
                }
                if (this._itemExInfo) 
                {
                    loc4 = this._itemExInfo.bind;
                }
                if (loc4 != 0) 
                {
                    if (loc6 = GameDefConfig.instance.getEBind(loc4)) 
                    {
                        loc3 = loc6.name;
                    }
                }
            }
            return HTMLUtil.addColor(loc2 + "    " + loc3, loc1);
        }

        public getCraveTx(): string
        {
            var loc1="";
            if (this._itemExInfo) 
            {
                var loc2;
                loc1 = loc2 = Cache.instance.pack.mountsPackCache.getCraveTx(this.itemData);
                return loc2;
            }
            return loc1;
        }

        public getItemDescText(): string
        {
            var loc2=null;
            var loc1="";
            if (this._tItem) 
            {
                if (!(this._tItem.descStr == "") && !(this._tItem.descStr == "0")) 
                {
                    loc1 = "<textFormat leading=\'5\'>" + HTMLUtil.addColor(this._tItem.descStr, "#ffffff") + "</textFormat>";
                }
            }
            if (ParamsConst.instance.proxyType == ProxyType.TW && !(ParamsConst.instance.gameName == null)) 
            {
                if (loc1.indexOf(ParamsConst.instance.gameName) >= 0) 
                {
                    loc2 = new RegExp(ParamsConst.instance.gameName, "g");
                    loc1 = loc1.replace(loc2, "");
                }
            }
            return loc1;
        }

        public getMountSexLimitTx(): string
        {
            var loc2=null;
            var loc4=0;
            var loc5=null;
            var loc1=Language.getString(70169);
            var loc3=GlobalStyle.color6;
            if (this._itemExInfo) 
            {
                loc4 = MountConfig.instance.getSexLimit(this._itemExInfo.model_id);
            }
            else 
            {
                loc5 = ItemConfig.instance.getInfoByCode(this._itemData.itemCode);
                loc4 = MountConfig.instance.getSexLimit(loc5.modelId);
            }
            if (loc4 != ESex._ESexMan) 
            {
                if (loc4 != ESex._ESexWoman) 
                {
                    if (loc4 != 2) 
                    {
                        loc1 = loc1 + Language.getString(70172);
                    }
                    else 
                    {
                        loc1 = loc1 + Language.getString(70172);
                    }
                }
                else if (Cache.instance.role.entityInfo.sex != ESex._ESexWoman) 
                {
                    loc1 = loc1 + HTMLUtil.addColor(Language.getString(70171), GlobalStyle.color7);
                }
                else 
                {
                    loc1 = loc1 + Language.getString(70171);
                }
            }
            else if (Cache.instance.role.entityInfo.sex != ESex._ESexMan) 
            {
                loc1 = loc1 + HTMLUtil.addColor(Language.getString(70170), GlobalStyle.color7);
            }
            else 
            {
                loc1 = loc1 + Language.getString(70170);
            }
            var loc6;
            loc2 = loc6 = "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, loc3) + "</textFormat>";
            return loc6;
        }

        public getSellToSysText(): string
        {
            var loc3=null;
            var loc1="";
            var loc2="";
            if (this._tItem) 
            {
                if (this._tItem.sell == 1) 
                {
                    loc3 = GameDefConfig.instance.getEPrictUnitName(this._tItem.sellUnit);
                    loc2 = this._tItem.sellPrice + "\t" + loc3;
                }
            }
            if (loc2 != "") 
            {
                loc1 = HTMLUtil.addColor(Language.getString(90212) + loc2, "#7c7c7c");
            }
            return loc1;
        }

        public getSpeedText(): string
        {
            var loc1="";
            if (this._itemExInfo == null) 
            {
                loc1 = loc1 + Language.getStringByParam(90207, Math.floor(this.itemData.itemInfo.extend.baseSpeed - 100 + (this.itemData.itemInfo.extend.initLevel - 1) * this.speedValue()).toString());
            }
            else 
            {
                loc1 = loc1 + Language.getStringByParam(90207, (this._itemExInfo.speed - 100).toString());
            }
            return HTMLUtil.addColor(loc1, "#00ff00");
        }

        /* internal  */getTotalGrowText(): string
        {
            var loc2=0;
            var loc1="";
            if (this.itemData && this.itemData.itemExInfo) 
            {
                loc2 = Cache.instance.pack.mountsPackCache.getTotalGrowValue(this._itemData);
                loc1 = loc1 + Language.getStringByParam(70038, loc2);
            }
            else 
            {
                loc1 = loc1 + Language.getStringByParam(70038, Cache.instance.pack.mountsPackCache.BASETOTALVALUE);
            }
            return HTMLUtil.addColor(loc1, "#00ff00");
        }

        /* internal  */getGrowPropText(): string
        {
            var loc4=null;
            var loc5=null;
            var loc6=0;
            var loc7=0;
            var loc8=0;
            var loc9=0;
            var loc1=Language.getString(70009).split(",");
            var loc2="";
            var loc3="#B1efff";
            if (this._itemData && this._itemData.itemExInfo) 
            {
                loc4 = Cache.instance.pack.mountsPackCache.getAttrGrowValue(this.itemData);
                loc6 = 0;
                while (loc6 < loc4.length) 
                {
                    if (this._itemData.itemExInfo) 
                    {
                        loc7 = Cache.instance.pack.mountsPackCache.getEachTotalGrowValue(this.itemData);
                        if (loc4[loc6] != loc7) 
                        {
                            loc5 = "";
                        }
                        else 
                        {
                            loc5 = Language.getString(70136);
                        }
                    }
                    else 
                    {
                        loc5 = "";
                    }
                    loc2 = loc2 + (loc1[loc6] + "     " + loc4[loc6] + "    " + loc5 + "<br>");
                    ++loc6;
                }
            }
            else 
            {
                loc8 = 0;
                while (loc8 < loc1.length) 
                {
                    loc9 = Cache.instance.pack.mountsPackCache.BASETOTALVALUE * 0.2;
                    loc2 = loc2 + (loc1[loc8] + "     " + loc9 + "<br>");
                    ++loc8;
                }
            }
            return "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc2, loc3) + "</textFormat>";
        }

        /* internal  */getBasePropText(): string
        {
            var loc8=0;
            var loc9=0;
            var loc10=null;
            var loc11=0;
            var loc12=0;
            var loc13=0;
            var loc14=0;
            var loc1=HTMLUtil.addColor(Language.getString(70040), GlobalStyle.color9);
            var loc2=Language.getString(70041).split(",");
            var loc3=[];
            var loc4="#f0ea3f";
            var loc5=this.getBaseAttrByConfig();
            if (this.itemData && this._itemExInfo) 
            {
                loc8 = this.itemData.itemExInfo.m_adv_lv;
                loc9 = this._itemExInfo.m_care_b;
                loc10 = Cache.instance.pack.mountsPackCache.getForsterArr(this.itemData, loc9);
                loc11 = 0;
                while (loc11 < loc5.length) 
                {
                    loc12 = int(loc5[loc11].value) + Cache.instance.pack.mountsPackCache.getUpgradeBaseAttrValue(this._itemData, loc8, false, loc9)[loc11] + loc10[loc11];
                    loc3.push(loc12);
                    ++loc11;
                }
            }
            else 
            {
                loc13 = 1;
                loc14 = 0;
                while (loc14 < loc5.length) 
                {
                    loc12 = int(loc5[loc14].value);
                    loc3.push(loc12);
                    ++loc14;
                }
            }
            var loc6=loc3.length;
            var loc7=0;
            while (loc7 < loc6) 
            {
                loc1 = loc1 + ("<br>" + loc2[loc7] + "        " + loc3[loc7]);
                ++loc7;
            }
            return "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, loc4) + "</textFormat>";
        }

        /* internal  */getBaseAddText(): string
        {
            var loc2=0;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            var loc6=0;
            var loc1="";
            if (this.itemData && this._itemExInfo) 
            {
                loc2 = this._itemExInfo.m_care_b;
                loc3 = Cache.instance.pack.mountsPackCache.getMountExtendBaseAdd(this._itemData);
                loc4 = Cache.instance.pack.mountsPackCache.getSpecialGradValue(this._itemData.itemExInfo.m_adv_lv, loc2);
                loc5 = loc3.length;
                if (loc3[0] + loc4[0] > 0 || loc3[0] + loc4[4] > 0) 
                {
                    loc6 = 0;
                    while (loc6 < loc5) 
                    {
                        loc1 = loc1 + ("+" + (loc3[loc6] + loc4[loc6]) + "" + "<br>");
                        ++loc6;
                    }
                }
            }
            return "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, "#60e71e") + "</textFormat>";
        }

        /* internal  */speedValue(): number
        {
            var loc1=this._itemData.color;
            switch (loc1) 
            {
                case 1:
                {
                    return 0.55;
                }
                case 2:
                {
                    return 0.65;
                }
                case 3:
                {
                    return 0.8;
                }
                case 4:
                {
                    return 0.95;
                }
                case 5:
                {
                    return 1.2;
                }
            }
            return 1;
        }

        public getAddtionalProps(): string
        {
            var loc2=0;
            var loc6=0;
            var loc7=null;
            var loc8=0;
            var loc9=null;
            var loc1="";
            var loc3=false;
            var loc4;
            if ((loc4 = this.getAddtionalArray()).length == 0) 
            {
                if (this._itemData.uid == null) 
                {
                    loc3 = true;
                    loc2 = (this._tItem.color - 1);
                    while (loc6 < loc2) 
                    {
                        (loc7 = new Map<any, any> /* flash.utils.Dictionary */())["key"] = 0;
                        loc7["name"] = "？？";
                        loc7["value"] = "？？？";
                        loc4.push(loc7);
                        ++loc6;
                    }
                }
            }
            var loc5="";
            if (loc4.length > 0) 
            {
                loc1 = HTMLUtil.addColor(Language.getString(90213), GlobalStyle.color9);
            }
            loc6 = 0;
            while (loc6 < loc4.length) 
            {
                loc9 = loc4[loc6] as Map<any, any> /* flash.utils.Dictionary */;
                if (loc3) 
                {
                    loc1 = loc1 + ("\r " + loc9["name"] + "：         " + loc9["value"]);
                }
                else if (this._itemExInfo && this._itemExInfo.mount_rein >= 2) 
                {
                    if (loc6 % 2 != 0) 
                    {
                        loc1 = loc1 + (loc9["name"] + "： " + loc9["value"]);
                    }
                    else 
                    {
                        loc1 = loc1 + ("\r" + loc9["name"] + "： " + loc9["value"] + this.getAdditionSpace(loc9["value"]));
                    }
                }
                else if (loc9["name"].length != 2) 
                {
                    loc1 = loc1 + ("\r" + loc9["name"] + "：" + "     " + loc9["value"]);
                }
                else 
                {
                    loc1 = loc1 + ("\r" + loc9["name"] + "：" + "        " + loc9["value"]);
                }
                ++loc6;
            }
            if (loc1 != "") 
            {
                loc5 = MountAddValue.getColorValue(loc9["key"], loc9["value"]);
                loc1 = "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, loc5) + "</textFormat>";
            }
            return loc1;
        }

        /* internal  */getAdditionSpace(arg1: int): string
        {
            var loc1=" ";
            var loc2=14 - arg1.toString().length;
            var loc3=0;
            while (loc3 < loc2) 
            {
                loc1 = loc1 + " ";
                ++loc3;
            }
            return loc1;
        }

        public getAddtionalArray(): Array<any>
        {
            var loc5=0;
            var loc6=null;
            var loc7=null;
            var loc8=null;
            var loc9=null;
            var loc10=null;
            var loc11=false;
            var loc12=0;
            var loc13=0;
            var loc14=null;
            var loc15=null;
            var loc1=[];
            if (this._tItem.color <= 1) 
            {
                return loc1;
            }
            var loc2=[];
            var loc3=[];
            if (this._itemExInfo) 
            {
                loc2.push(this._itemExInfo.addition1);
                loc2.push(this._itemExInfo.addition2);
                loc2.push(this._itemExInfo.addition3);
                loc2.push(this._itemExInfo.addition4);
                loc2.push(this._itemExInfo.addition5);
                loc2.push(this._itemExInfo.addition6);
                loc2.push(this._itemExInfo.addition7);
                loc3.push(this._itemExInfo.addVal1);
                loc3.push(this._itemExInfo.addVal2);
                loc3.push(this._itemExInfo.addVal3);
                loc3.push(this._itemExInfo.addVal4);
                loc3.push(this._itemExInfo.addVal5);
                loc3.push(this._itemExInfo.addVal6);
                loc3.push(this._itemExInfo.addVal7);
            }
            else 
            {
                loc1 = this.getAddtionalByConfig();
                return loc1;
            }
            var loc4=0;
            while (loc4 < loc2.length) 
            {
                if ((loc5 = loc2[loc4]) > 0 && MountUtil.isCriticalFitCurCarrer(loc5)) 
                {
                    loc6 = new Map<any, any> /* flash.utils.Dictionary */();
                    loc7 = GameDefConfig.instance.getEJewel(loc5);
                    loc6["key"] = loc5;
                    if (loc7) 
                    {
                        if (loc5 == 12 || loc5 == 13) 
                        {
                            loc6["name"] = Language.getString(36306);
                        }
                        else 
                        {
                            loc6["name"] = loc7.text1;
                        }
                    }
                    else 
                    {
                        loc6["name"] = "";
                    }
                    loc6["value"] = loc3[loc4];
                    loc1.push(loc6);
                }
                ++loc4;
            }
            if (this._itemExInfo.mount_rein >= 1) 
            {
                loc8 = MountUtil.getConfigNextReinAddtionalArray(this._itemData, false);
                loc12 = 0;
                while (loc12 < loc8.length) 
                {
                    loc11 = false;
                    loc10 = loc8[loc12];
                    loc13 = 0;
                    while (loc13 < loc1.length) 
                    {
                        if (!(loc9 = loc1[loc13])["add"] || loc9["add"] == "") 
                        {
                            loc9["add"] = 0;
                        }
                        if (loc10["key"] == loc9["key"]) 
                        {
                            loc9["value"] = loc9["value"] + loc10["value"];
                            loc9["add"] = Math.abs(loc10["value"] - loc9["value"]);
                            loc11 = true;
                            break;
                        }
                        ++loc13;
                    }
                    if (!loc11) 
                    {
                        (loc14 = new Map<any, any> /* flash.utils.Dictionary */())["key"] = loc10["key"];
                        loc15 = GameDefConfig.instance.getEJewel(loc14["key"]);
                        loc14["value"] = loc10["value"];
                        loc14["add"] = loc10["value"];
                        loc14["name"] = loc15.text1;
                        loc1.push(loc14);
                    }
                    ++loc12;
                }
                loc1.sortOn("value", Array.NUMERIC);
                return loc1;
            }
            return loc1;
        }

        /* internal  */getAddtionalByConfig(): Array<any>
        {
            var loc1=[];
            this.buildAddtion(loc1, "life", EJewel._EJewelLife);
            this.buildAddtion(loc1, "jouk", EJewel._EJewelJouk);
            this.buildAddtion(loc1, "magicDefense", EJewel._EJewelMagicDefense);
            this.buildAddtion(loc1, "physicalDefense", EJewel._EJewelPhysicalDefense);
            this.buildAddtion(loc1, "toughness", EJewel._EJewelToughness);
            if (loc1.length > (this._itemData.color - 1)) 
            {
                return [];
            }
            return loc1;
        }

        /* internal  */buildAddtion(arg1: Array<any>, arg2: string, arg3: int): void
        {
            var loc1=null;
            var loc2=null;
            if ((loc1 = this._itemData.itemInfo.extend[arg2].split(",")).length == 2) 
            {
                if (loc1[0] == loc1[1] && !(loc1[0] == 0)) 
                {
                    (loc2 = new Map<any, any> /* flash.utils.Dictionary */())["key"] = arg3;
                    loc2["name"] = GameDefConfig.instance.getEJewel(arg3).text1;
                    loc2["value"] = loc1[0];
                    arg1.push(loc2);
                }
            }
            return;
        }

        public get itemData(): ItemData
        {
            return this._itemData;
        }

        public set itemData(arg1: ItemData)
        {
            this._itemData = arg1;
            return;
        }

        /* internal  */updateUI(): void
        {
            var loc4=false;
            var loc8=0;
            var loc9=0;
            var loc10=0;
            var loc11=0;
            var loc12=null;
            this._currentY = 0;
            this._needY = 0;
            this._nameLabel.htmlText = this.getNameText();
            this._currentY = this._currentY + this._nameLabel.textField.height;
            this._needY = this._currentY;
            this._imageBg.y = this._currentY + 5;
            this._eqItem.itemData = this._itemData;
            this._eqItem.amount = -1;
            this._eqItem.move(9, this._currentY + 5);
            this._currentY = this._currentY + (this._imageBg.height + 15);
            this._needLevelLabel.htmlText = this.getNeedLevelText();
            this._needLevelLabel.move(59, this._needY);
            this._mountLevel.htmlText = this.getMountLevelText();
            this._needY = this._needY + (this._nameLabel.textField.height - 1);
            this._mountLevel.move(59, this._needY);
            this._changing.htmlText = this.getChangingTx();
            this._changing.move(153, this._needY - 2);
            this._sexLimit.htmlText = this.getMountSexLimitTx();
            this._needY = this._needY + (this._mountLevel.textField.height - 5);
            this._sexLimit.move(59, this._needY);
            this._itemTypeBindLabel.htmlText = this.getItemTypeBindText();
            this._itemTypeBindLabel.move(9, this._currentY);
            this._currentY = this._currentY + this._itemTypeBindLabel.textField.height;
            if (this._itemExInfo && Cache.instance.pack.mountsPackCache.isHaveCraveTx(this.itemData)) 
            {
                loc8 = Cache.instance.pack.mountsPackCache.getWorldColor(this.itemData);
                loc9 = Cache.instance.pack.mountsPackCache.getCraveColor(loc8);
                this._craveTx.text = this.getCraveTx();
                this._craveTx.setTextFormat(new GTextFormat(FontUtil.lishuName, 20, loc9, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
                loc10 = Cache.instance.pack.mountsPackCache.getGlowColor(this.itemData);
                loc11 = Cache.instance.pack.mountsPackCache.getCraveColor(loc10);
                loc12 = new Object /* flash.filters.GlowFilter */(loc11, 1, 10, 10, 2);
                EffectManager.glowFilterReg(this._craveTx, [loc12], 0.3, 10);
                this._craveTx.y = this._currentY + 2;
                this._currentY = this._currentY + 28;
            }
            else 
            {
                this._craveTx.htmlText = "";
            }
            if (!this._modulePanel) 
            {
                this._modulePanel = new MountModelPanel();
                this._modulePanel.mouseChildren = false;
                this._modulePanel.mouseEnabled = false;
            }
            this._modulePanel.x = 90;
            this._modulePanel.y = this._currentY + 92;
            this._modulePanel.load(this._itemData);
            if (!this.contains(this._modulePanel)) 
            {
                this.addChildAt(this._modulePanel, 0);
            }
            if (this._mountOwnBmp && this.contains(this._mountOwnBmp)) 
            {
                this.removeChild(this._mountOwnBmp);
            }
            if (this._mountOwnBmp == null) 
            {
                this._mountOwnBmp = new Object /* flash.display.Bitmap */();
                this._mountOwnBmp.x = 120;
                this._mountOwnBmp.y = -10;
            }
            if (MountUtil.instance.isOwnMount(MountUtil.instance.getAllMount(), MountUtil.instance.getCurSexMountRealModelId(this._itemData))) 
            {
                this._mountOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipOwned);
            }
            else 
            {
                this._mountOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipNotOwned);
            }
            if (this._mountOwnBmp && !this.contains(this._mountOwnBmp)) 
            {
                this.addChildAt(this._mountOwnBmp, 1);
            }
            this._currentY = this._currentY + 120;
            this._speed.htmlText = this.getSpeedText();
            this._speed.move(9, this._currentY);
            this._currentY = this._currentY + this._speed.textField.height;
            this._basePropLabel.htmlText = this.getBasePropText();
            this._baseAddLabel.htmlText = this.getBaseAddText();
            this._basePropLabel.move(9, this._currentY);
            this._baseAddLabel.move(130, this._currentY + 17);
            this._currentY = this._currentY + this._basePropLabel.textField.height;
            this.addChild(this._basePropLabel);
            this.addChild(this._baseAddLabel);
            var loc1=ColorConfig.instance.getItem("item", this._tItem.color.toString());
            var loc2="";
            if (loc1) 
            {
                loc2 = loc1.color;
            }
            var loc3=this.getAddtionalArray();
            if (loc3.length > 0) 
            {
                if (this._itemExInfo && this._itemExInfo.mount_rein >= 2) 
                {
                    loc4 = false;
                }
                else 
                {
                    loc4 = true;
                }
                if (!this._addtinalProp) 
                {
                    this._addtinalProp = new MountsToolTipPropSp();
                }
                this._addtinalProp.setTitleTx(Language.getString(90213));
                this._addtinalProp.setData(loc3, loc4, loc2);
                this._addtinalProp.x = 9;
                this._addtinalProp.y = this._currentY;
                this.addChild(this._addtinalProp);
                this._currentY = this._currentY + this._addtinalProp.height;
            }
            else if (this._addtinalProp && this.contains(this._addtinalProp)) 
            {
                this.removeChild(this._addtinalProp);
            }
            var loc5=[];
            if (this._itemExInfo) 
            {
                (loc5 = MountUtil.instance.getAllStartsData(this._itemData.itemExInfo.m_stLv, this._itemData.itemExInfo.m_stTa)).sortOn("key");
            }
            if (loc5.length > 0) 
            {
                if (!this._startProp) 
                {
                    this._startProp = new MountsToolTipPropSp();
                }
                this._startProp.setTitleTx(Language.getString(70274));
                this._startProp.setData(loc5, false, loc2);
                this._startProp.x = 9;
                this._startProp.y = this._currentY;
                this.addChild(this._startProp);
                this._currentY = this._currentY + this._startProp.height;
            }
            else if (this._startProp && this.contains(this._startProp)) 
            {
                this.removeChild(this._startProp);
            }
            var loc6;
            if ((loc6 = this.getItemDescText()) == "") 
            {
                this._itemDescTextField.visible = false;
                this._sellToSysLabel.text = "";
            }
            else 
            {
                this._itemDescTextField.visible = true;
                this._itemDescTextField.htmlText = loc6;
                this._itemDescTextField.x = 9;
                this._itemDescTextField.y = this._currentY;
                this._currentY = this._currentY + this._itemDescTextField.height;
            }
            var loc7;
            if ((loc7 = this.getSellToSysText()) == "") 
            {
                this._sellToSysLabel.visible = false;
                this._sellToSysLabel.text = "";
            }
            else 
            {
                this._sellToSysLabel.visible = true;
                this._sellToSysLabel.htmlText = loc7;
                this._sellToSysLabel.move(9, this._currentY);
                this._currentY = this._currentY + this._sellToSysLabel.textField.height;
            }
            this._sendToChatLabel.move(9, this._currentY);
            this._currentY = this._currentY + (this._sendToChatLabel.textField.height + 5);
            this._nameLabel.x = (this.width - this._nameLabel.textField.width) / 2;
            return;
        }

        public dispose(): void
        {
            if (this._modulePanel) 
            {
                if (contains(this._modulePanel)) 
                {
                    removeChild(this._modulePanel);
                }
                this._modulePanel.clear();
                this._modulePanel = null;
                EffectManager.glowFilterUnReg(this._craveTx);
            }
            return;
        }

        public /* override */ get width(): number
        {
            return 210;
        }

        public /* override */ get height(): number
        {
            return this._currentY;
        }

        public set data(arg1: ItemData)
        {
            if (arg1 != null) 
            {
                this._itemData = arg1;
                this._itemExInfo = this._itemData.itemExInfo;
                if (this._itemData.itemInfo) 
                {
                    this._tItem = this._itemData.itemInfo.item;
                }
                this.updateUI();
            }
            return;
        }

        /* internal  */initUI(): void
        {
            this._nameLabel = new GLabel();
            this._nameLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._nameLabel.setStyle("textFormat", new GTextFormat(FontUtil.songtiName, 14, null, true, null, null, null, null, flash.text.TextFieldAutoSize.LEFT));
            this._nameLabel.filters = [FilterConst.glowFilter];
            this.addChild(this._nameLabel);
            this._imageBg = GlobalClass.getBitmap("PackItemBg");
            this._imageBg.width = 38;
            this._imageBg.height = 38;
            this._imageBg.x = 9;
            this.addChild(this._imageBg);
            this._eqItem = new BaseItem();
            this._eqItem.isShowToolTip = false;
            this._eqItem.setSize(38, 38);
            this.addChild(this._eqItem);
            this._needLevelLabel = new GLabel();
            this._needLevelLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._needLevelLabel.filters = [FilterConst.glowFilter];
            this.addChild(this._needLevelLabel);
            this._mountLevel = new GLabel();
            this._mountLevel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._mountLevel.filters = [FilterConst.glowFilter];
            this.addChild(this._mountLevel);
            this._changing = new GLabel();
            this._changing.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._changing.setStyle("textFormat", new GTextFormat(FontUtil.songtiName, 14, null, true, null, null, null, null, "center"));
            this._changing.textField.filters = [FilterConst.glowFilter];
            this.addChild(this._changing);
            this._sexLimit = new GLabel();
            this._sexLimit.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._sexLimit.filters = [FilterConst.glowFilter];
            this.addChild(this._sexLimit);
            this._itemTypeBindLabel = new GLabel();
            this._itemTypeBindLabel.filters = [FilterConst.glowFilter];
            this._itemTypeBindLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this.addChild(this._itemTypeBindLabel);
            this._craveTx = new Object /* flash.text.TextField */();
            this._craveTx.x = 3;
            this._craveTx.width = 203;
            this._craveTx.height = 28;
            this._craveTx.selectable = false;
            addChild(this._craveTx);
            this._speed = new GLabel();
            this._speed.filters = [FilterConst.glowFilter];
            this._speed.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this.addChild(this._speed);
            this._basePropLabel = new GLabel();
            this._basePropLabel.filters = [FilterConst.glowFilter];
            this._basePropLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._basePropLabel.textField.multiline = true;
            this._baseAddLabel = new GLabel();
            this._baseAddLabel.filters = [FilterConst.glowFilter];
            this._baseAddLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._baseAddLabel.textField.multiline = true;
            this._itemDescTextField = new GTextFiled();
            this._itemDescTextField.width = 180;
            this._itemDescTextField.wordWrap = true;
            this._itemDescTextField.multiline = true;
            this._itemDescTextField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._itemDescTextField.x = 9;
            this._itemDescTextField.y = this._currentY;
            this.addChild(this._itemDescTextField);
            this._sellToSysLabel = new GLabel();
            this._sellToSysLabel.filters = [FilterConst.glowFilter];
            this._sellToSysLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._sellToSysLabel.htmlText = this.getSellToSysText();
            this.addChild(this._sellToSysLabel);
            this._sendToChatLabel = new GLabel();
            this._sendToChatLabel.filters = [FilterConst.glowFilter];
            this._sendToChatLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._sendToChatLabel.htmlText = HTMLUtil.addColor(Language.getString(90210), "#ffffff");
            this.addChild(this._sendToChatLabel);
            return;
        }

        /* internal  */getBaseAttrByConfig(): Array<any>
        {
            var loc1=[];
            this.buildAddtion(loc1, "power", EJewel._EJewelPower);
            this.buildAddtion(loc1, "agile", EJewel._EJewelAgile);
            this.buildAddtion(loc1, "habitus", EJewel._EJewelHabitus);
            this.buildAddtion(loc1, "brains", EJewel._EJewelBrains);
            this.buildAddtion(loc1, "spiritual", EJewel._EJewelSpiritual);
            return loc1;
        }

        /* internal  */getStartAddProps(): string
        {
            var loc2=null;
            var loc3=0;
            var loc4=null;
            var loc5=0;
            var loc6=null;
            var loc1="";
            if (this._itemExInfo && this._itemExInfo.mount_rein >= 2) 
            {
                loc1 = HTMLUtil.addColor(Language.getString(70274), GlobalStyle.color9) + "<br>";
                loc2 = MountUtil.instance.getAllStartsData(this._itemData.itemExInfo.m_stLv, this._itemData.itemExInfo.m_stTa);
                loc2.sortOn("value", Array.NUMERIC);
                loc3 = loc2.length;
                loc5 = 0;
                while (loc5 < loc3) 
                {
                    loc4 = loc2[loc5];
                    if (loc5 % 2 != 0) 
                    {
                        loc1 = loc1 + (loc4["name"] + "： " + loc4["value"]);
                    }
                    else 
                    {
                        loc1 = loc1 + ("\r" + loc4["name"] + "： " + loc4["value"] + this.getAdditionSpace(loc4["value"]));
                    }
                    ++loc5;
                }
            }
            if (loc1 != "") 
            {
                loc6 = MountAddValue.getColorValue(loc4["key"], loc4["value"]);
                loc1 = "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, loc6) + "</textFormat>";
            }
            return loc1;
        }

        /* internal  */getChangingTx(): string
        {
            var loc1="";
            if (this._itemData && this._itemData.itemExInfo) 
            {
                if (this._itemData.itemInfo.modelId !== this._itemData.itemExInfo.model_id) 
                {
                    loc1 = Language.getString(70156);
                }
            }
            return loc1;
        }

        public getNameText(): string
        {
            var loc3=null;
            var loc4=0;
            var loc5=null;
            var loc6=null;
            var loc7=null;
            var loc1="";
            var loc2="";
            if (this._itemData && this._itemData.itemExInfo) 
            {
                if (this._itemExInfo.mount_rein != 0) 
                {
                    loc3 = "[" + Language.getStringByParam(70224, this._itemExInfo.mount_rein) + "]";
                }
                else 
                {
                    loc3 = "";
                }
                loc4 = this._itemData.itemExInfo.m_adv_lv;
                if (this._tItem) 
                {
                    loc1 = loc3 + this._tItem.name + "(" + loc4 + "☆)";
                    if (loc5 = ColorConfig.instance.getItem("item", this._tItem.color.toString())) 
                    {
                        loc2 = loc5.color;
                    }
                }
            }
            else if (this._tItem) 
            {
                loc1 = this._tItem.name + "(" + 0 + "☆)";
                if (loc6 = ColorConfig.instance.getItem("item", this._tItem.color.toString())) 
                {
                    loc2 = loc6.color;
                }
            }
            if (ParamsConst.instance.proxyType == ProxyType.TW && !(ParamsConst.instance.gameName == null)) 
            {
                if (loc1.indexOf(ParamsConst.instance.gameName) >= 0) 
                {
                    loc7 = new RegExp(ParamsConst.instance.gameName, "g");
                    loc1 = loc1.replace(loc7, "");
                }
            }
            return HTMLUtil.addColor(loc1, loc2);
        }

        /* internal */ /* var */_nameLabel: GLabel;

        /* internal */ /* var */_imageBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_eqItem: BaseItem;

        /* internal */ /* var */_needLevelLabel: GLabel;

        /* internal */ /* var */_mountLevel: GLabel;

        /* internal */ /* var */_changing: GLabel;

        /* internal */ /* var */_itemTypeBindLabel: GLabel;

        /* internal */ /* var */_craveTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_itemDescTextField: GTextFiled;

        /* internal */ /* var */_sellToSysLabel: GLabel;

        /* internal */ /* var */_sendToChatLabel: GLabel;

        /* internal */ /* var */_speed: GLabel;

        /* internal */ /* var */_basePropLabel: GLabel;

        /* internal */ /* var */_baseAddLabel: GLabel;

        /* internal */ /* var */_addtinalProp: MountsToolTipPropSp;

        /* internal */ /* var */_startProp: MountsToolTipPropSp;

        /* internal */ /* var */_itemData: ItemData;

        /* internal */ /* var */_tItem: TItem;

        /* internal */ /* var */_itemExInfo: ItemExInfo;

        /* internal */ /* var */_needY: int=0;

        /* internal */ /* var */_mountOwnBmp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_modulePanel: MountModelPanel;

        /* internal */ /* var */_currentY: int;

        /* internal */ /* var */_sexLimit: GLabel;
    }
